<template>
  <div class="content-area">
    <h2>用户管理</h2>
    <div class="content">
      <el-table :data="userList" style="width: 100%">
        <el-table-column prop="id" label="ID" width="80" />
        <el-table-column prop="username" label="用户名" width="120" />
        <el-table-column prop="email" label="邮箱" width="200" />
        <el-table-column prop="role" label="角色" width="120" />
        <el-table-column prop="status" label="状态" width="100">
          <template #default="scope">
            <el-tag :type="scope.row.status === '启用' ? 'success' : 'danger'">
              {{ scope.row.status }}
            </el-tag>
          </template>
        </el-table-column>
        <el-table-column label="操作" width="200">
          <template #default="scope">
            <el-button size="small" @click="handleEdit(scope.row)">编辑</el-button>
            <el-button size="small" type="danger" @click="handleDelete(scope.row)">删除</el-button>
          </template>
        </el-table-column>
      </el-table>
    </div>
  </div>
</template>

<script>
export default {
  name: 'UserManagement',
  data() {
    return {
      userList: [
        { id: 1, username: 'admin', email: 'admin@example.com', role: '管理员', status: '启用' },
        { id: 2, username: 'user1', email: 'user1@example.com', role: '普通用户', status: '启用' },
        { id: 3, username: 'user2', email: 'user2@example.com', role: '普通用户', status: '禁用' }
      ]
    }
  },
  methods: {
    handleEdit(row) {
      console.log('编辑用户:', row)
    },
    handleDelete(row) {
      console.log('删除用户:', row)
    }
  }
}
</script>

<style scoped>
.content-area {
  background: white;
  border-radius: 8px;
  padding: 30px;
  box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
  min-height: 400px;
}

.content-area h2 {
  color: #303133;
  margin-bottom: 20px;
  border-bottom: 2px solid #409eff;
  padding-bottom: 10px;
}

.content {
  color: #606266;
  line-height: 1.8;
  font-size: 16px;
}
</style> 